#include <iostream>
#include <string>
#include <queue>
using namespace std;
struct node
{
    string name;
    node *left = nullptr;
    node *right = nullptr;
    node(string s)
    {
        name = s;
    }
    node(string s, node *l, node *r)
    {
        name = s, left = l, right = r;
    }
};
class tree
{
private:
public:
    node *root = nullptr;
    tree(node *root_node);
    void add_left(node *cur_node, node *next_node);
    void add_right(node *cur_node, node *next_node);
    void print_tree();
    ~tree();
};
void tree::print_tree()
{
    queue<node *> node_que;
    node_que.push(root);
    node *cur_node;
    while (!node_que.empty())
    {
        cur_node = node_que.front();
        node_que.pop();
        cout << cur_node->name;
        if (cur_node->left != nullptr)
        {
            node_que.push(cur_node->left);
        }
        if (cur_node->right != nullptr)
        {
            node_que.push(cur_node->right);
        }
    }
}
void tree::add_left(node *cur_node, node *next_node)
{
    cur_node->left = next_node;
}
void tree::add_right(node *cur_node, node *next_node)
{
    cur_node->right = next_node;
}
tree::tree(node *root_node)
{
    root = root_node;
}

tree::~tree()
{
}

int main()
{
    node root_node("a");
    tree binary_t(&root_node);
    node cur_node = root_node;
    node next_node("b");
    binary_t.add_left(&cur_node, &next_node);
    node next_node("c");
    binary_t.add_right(&cur_node, &next_node);
    binary_t.print_tree();
    return 0;
}
